win32 theme: Make tooltips look right
authorBenjamin Otte <otte@redhat.com>
Mon, 22 Feb 2016 03:16:36 +0000 (04:16 +0100)
committerBenjamin Otte <otte@redhat.com>
Mon, 22 Feb 2016 03:37:57 +0000 (04:37 +0100)
Includes adding fallback support

gtk/gtkwin32draw.c
gtk/theme/win32/gtk-win32-base.css

index 6caaa77afbcf9a28f38d1db4933bedc851e9ba3c..0483723d34e3bfbbfbd7a541ec8d54946fe81489 100644 (file)
@@ -234,6 +234,25 @@ draw_window_button (cairo_t *cr,
   mask_icon (cr, icon, 1, 1, width - 2, height - 2);
 }
 
+static void
+draw_tooltip (cairo_t *cr,
+              int      part,
+              int      state,
+              int      width,
+              int      height)
+{
+  int xborder = gtk_win32_get_sys_metric (GTK_WIN32_SYS_METRIC_CXDLGFRAME) -
+                gtk_win32_get_sys_metric (GTK_WIN32_SYS_METRIC_CXEDGE);
+  int yborder = gtk_win32_get_sys_metric (GTK_WIN32_SYS_METRIC_CYDLGFRAME) -
+                gtk_win32_get_sys_metric (GTK_WIN32_SYS_METRIC_CYEDGE);
+
+  cairo_rectangle (cr, 0, 0, width, height);
+  cairo_rectangle (cr, width - xborder, yborder,
+                   - (width - 2 * xborder), height - 2 * yborder);
+  gtk_cairo_set_source_sys_color (cr, GTK_WIN32_SYS_COLOR_WINDOWFRAME);
+  cairo_fill (cr);
+}
+
 typedef struct _GtkWin32ThemePart GtkWin32ThemePart;
 struct _GtkWin32ThemePart {
   const char *class_name;
@@ -251,6 +270,7 @@ static GtkWin32ThemePart theme_parts[] = {
   { "button",  1,  0, { 3, 3, 3, 3 }, draw_button },
   { "button",  2, 13, { 0, 0, 0, 0 }, draw_radio },
   { "button",  3, 13, { 0, 0, 0, 0 }, draw_check },
+  { "tooltip", 1,  0, { 0, 0, 0, 0 }, draw_tooltip },
   { "window",  1,  0, { 0, 0, 0, 0 }, draw_window },
   { "window", 15,  0, { 0, 0, 0, 0 }, draw_window_button },
   { "window", 17,  0, { 0, 0, 0, 0 }, draw_window_button },
index 1795d71f4008ee1300afd58ecc865f6ee97f6c9c..1c5026f22f2083c6e7659ca4f0c25883524a8af7 100644 (file)
@@ -117,15 +117,11 @@ scrolledwindow.frame {
   color: @selected_fg_color;
 }
 
-tooltip {
-    background-color: transparent;
-    background-image: -gtk-win32-theme-part(tooltip, 3, 1);
-    color: -gtk-win32-color(button, infotext);
-    border-width: 0px;
-}
-
-tooltip * {
+tooltip, tooltip.background {
+    background-color: -gtk-win32-color(tooltip, infobk);
+    background-image: -gtk-win32-theme-part(tooltip, 1, 1);
     color: -gtk-win32-color(button, infotext);
+    padding: 2px;
 }
 
 assistant .sidebar .highlight {